package com.itheima.mapper;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

//持久层接口
public interface UserMapper {

    //查找所有用户
    @Select("select * from user")
    List<User> findAll();

    //通过id数组删除用户
    void deleteByIds(Integer[] idArr);

    //保存用户
    @Select("insert into user values(null,#{age},#{username},#{password},#{email},#{sex})")
    Integer saveUser(User user);

    //通过id查找用户
    @Select("select * from user where id=#{uid}")
    User findById(String uid);


    //更新用户
    @Update("update user set age=#{age},username=#{username},password=#{password},email=#{email},sex=#{sex} where id=#{id}")
    void update(User user);
}
